<extend name="Public:common"/>
<block name="css">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css"  media="all">
    <style>
        th{text-align:center;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1><i class="fa fa-home"></i> 首页>产品管理>线路管理>申请合作的线路</h1></div>
     <div class="container-fluid">
         <div class="tabbable">
             <ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
                 <li <if condition="$post['partner_status'] eq 0">class="active"</if>>
                    <a href="javascript:checkStatus(0);" >待处理线路
                        <if condition="$cooperationCount"><span class="badge">{$cooperationCount}</span></if>
                    </a>
                 </li>
                 <li <if condition="$post['partner_status'] eq -1">class="active"</if>><a href="javascript:checkStatus(-1);" >已拒绝线路</a></li>
                 <li <if condition="$post['partner_status'] eq 1">class="active"</if>><a href="javascript:checkStatus(1);" >已同意线路</a></li>
             </ul>
             <div class="tab-content">
                 <div class="row" >
                     <form action="cooperationList" class="form-inline " method="get" style="margin-left:10px;" >
                         <input type="hidden" name="partner_status" value="{$post.partner_status|default=0}" style="display: none;">
                         <div class="form-group">
                             <label for="lineNum">线路编号</label>
                             <input type="text" class="" name="line_sn" id="line_sn" placeholder="线路编号" value="{$post.line_sn}">
                         </div>
                         <div class="form-group">
                             <label for="lineName">线路名称</label>
                             <input type="text" class="" name="line_name" id="line_name" placeholder="线路名称" value="{$post.line_name}">
                         </div>
                         <div class="form-group">
                             <label for="lineName">供应商</label>
                             <input type="text" class="" name="supplier_name" id="supplier_name" placeholder="供应商" value="{$post.supplier_name}">
                         </div>

                         <button type="submit" class="btn btn-primary">查询</button>
                     </form>
                 </div>

                 <table class="table table-striped table-bordered table-hover table-condensed text-center">
                     <tbody>
                         <tr>
                            <!-- <th>全选 <input type="checkbox" class="checkAll"></th>-->
                             <th>线路编号</th>
                             <th>线路名称</th>
                             <th>行程天数</th>
                             <th>出发地</th>
                             <th>供应商</th>
                             <th>成本价</th>
                             <th>状态</th>
                             <th>操作</th>
                         </tr>
                         <volist name="list" id="vo">
                         <tr>
                            <!-- <td><input type="checkbox" class="chk" value=""></td>-->
                             <td>{$vo.line_sn}</td>
                             <td>{$vo.line_name}</td>
                             <td>{$vo.till_day}</td>
                             <td>{$vo.areaName}</td>
                             <td> {$vo.supplier_name|default="无"}</td>
                             <td>
                                 <if condition="$vo['adult_money'] gt 0">
                                     成{$vo.adult_money};儿{$vo.child_money};老{$vo.oldman_money}
                                 </if>
                             </td>
                             <td>
                                 <switch name="vo.partner_status">
                                     <case value="0">[待处理]</case>
                                     <case value="-1">[已拒绝]</case>
                                     <case value="1">[合作中]</case>
                                 </switch>
                                 <switch name="vo.line_status">
                                     <case value="-1">[线路已下架]</case>
                                     <case value="0">[待上架审核]</case>
                                     <case value="1">[线路已上架]</case>
                                     <case value="-2">[线路已被拒]</case>
                                     <case value="-4">[线路已过期]</case>
                                     <case value="-3">[线路未编辑]</case>
                                 </switch>

                             </td>
                             <td>
                                 <if condition="$vo['new_line_id']">
                                     <if condition="checkAuth('Operator/Product/specialLineDetail')">
                                        <a href="{:U('specialLineDetail',array('id'=>$vo['new_line_id']))}" class="btn btn-xs btn-primary">详情</a>
                                     </if>
                                     <else/>
                                     <if condition="checkAuth('Operator/Product/supplierLineDetail')">
                                        <a href="{:U('supplierLineDetail',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">详情</a>
                                     </if>
                                 </if>
                                 <if condition="checkAuth('Operator/Product/cooperationHandle')">
                                     <if condition="$vo['partner_status'] eq 0">
                                         <a href="javascript:handle({$vo.partner_id},1)" class="btn btn-xs btn-primary">同意合作</a>
                                         <a href="javascript:handle({$vo.partner_id},-1)" class="btn btn-xs btn-danger">拒绝合作</a>
                                     </if>
                                 </if>
                                 <if condition="checkAuth('Operator/SpecialLine/form_step1')">
                                     <if condition="$vo['partner_status'] eq 1 && $vo['line_status'] eq -3">
                                         <a href="{:U('SpecialLine/form_step1',array('id'=>$vo['new_line_id']))}" class="btn btn-xs btn-primary">编辑线路</a>
                                     </if>
                                 </if>
                             </td>
                         </tr>
                         </volist>
                            <tr>
                                <td colspan="12">
                                    <ul class="pagination">
                                        {$show}
                                    </ul>
                                </td>
                            </tr>
                     </tbody>
                 </table>
             </div>
         </div>
     </div>
</block>
<block name="js">
    <script src="__STATIC__/layui/layui.all.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>

    <script>
        function checkStatus(status) {
            $('input[name="partner_status"]').val(status);
            $('form').submit();
        }

        function handle(id,status) {
            var statusName='确定同意合作吗?';
            if(status==-1){
                statusName='确定拒绝合作吗';
            }
            var r=confirm(statusName);
            if(r){
                location.href="/index.php?m=Operator&c=Product&a=cooperationHandle&id="+id+'&status='+status;
            }
        }


    </script>
</block>